﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleTaskManager.Domain.Entities;

namespace SimpleTaskManager.Domain.Abstract
{
    /// <summary>
    /// An interface for a repository containing the users of the application
    /// </summary>
    public interface IUserRepository
    {
        /// <summary>
        /// The collection of the users
        /// </summary>
        IQueryable<User> Users { get; }

        /// <summary>
        /// Adds a new user to the collection.
        /// </summary>
        /// <param name="user">The new user to add.</param>
        /// <param name="encrypter">The encrypter which can be used to hash the user's password.</param>
        void CreateUser(User user, IPasswordEncrypter encrypter);

        /// <summary>
        /// Removes a user from the collection
        /// </summary>
        /// <param name="id">The ID of the user who will be removed</param>
        void DeleteUser(int id);

        /// <summary>
        /// Saves the modifications of a user
        /// </summary>
        /// <param name="user">The user to modify</param>
        void EditUser(User user);

        /// <summary>
        /// Encrypts the given password and sets it as the password for the given user.
        /// </summary>
        /// <param name="user">The user whos password will be replaced.</param>
        /// <param name="password">The password which will be encrypted and set to the user.</param>
        /// <param name="encrypter">The encrypter which can be used to hash the user's password.</param>
        void ChangeUserPassword(User user, string password, IPasswordEncrypter encrypter);


        /// <summary>
        /// Adds new User_Skill (association between skill and user) to the reposiotry
        /// </summary>
        /// <param name="p">user id</param>
        /// <param name="skill">User_Skill which should be associated with the user identified by p</param>
        void AddSkill(int p, User_Skill skill);
    }
}
